package com.magi.builder;

import com.magi.config.IBaseBuildingConfig;
import com.magi.config.IXmlMapperBuildingConfig;
import com.magi.constant.DatabaseProducts;
import com.magi.core.TableMetaData;

public class XmlSQLMapperBuilder implements IXmlSQLMapperBuilder{
    private final IXmlSQLMapperBuilder builder;

    public XmlSQLMapperBuilder(IXmlMapperBuildingConfig config) {
        if (config.getDatabaseProductName().equals(DatabaseProducts.MYSQL)) {
            builder = new XmlMysqlMapperBuilder(config);
            return;
        }
        throw new RuntimeException("Unsupported database product " + config.getDatabaseProductName());
    }

    @Override
    public String text() {
        return builder.text();
    }

    @Override
    public String Build(TableMetaData metaData) {
        return builder.Build(metaData);
    }
}
